var testProjectGrid=Ext.create('Ext.grid.Panel', {
	title: '测试项目',
	store: testProjectStore,
	selModel:Ext.create('Ext.selection.CheckboxModel', {
		listeners: {
					selectionchange: function(sm, selections) {
						testProjectGrid.down('#deleteProjectButton').setDisabled(selections.length === 0);
					}
		}
	}),
	dockedItems:[{
		xtype: 'toolbar',
		items:[{
			text: '添加',
		    tooltip: '添加测试项目',
		    itemId:'addProjectButton',
		    icon: 'static/images/icons/fam/add.gif',
		    listeners: {
		        click: function () {
		        	testProjectAddClick();
		        }
		    }
		}, '-', {
			text: '删除',
		    tooltip: '删除测试项目',
		    itemId:'deleteProjectButton',
		    icon: 'static/images/icons/fam/delete.gif',
		    listeners: {
		        click: function () {
		        	testProjectDeleteClick();
		        }
		    }
		}]
	}],
	features: [{
		id: 'group',
		ftype: 'groupingsummary',
		groupHeaderTpl: new Ext.XTemplate(
				'基础系统: {[values.name.substring(32)]}'
		),
		hideGroupedHeader: false,
		enableGroupingMenu: false
	}],
	columns: [new Ext.grid.RowNumberer(), //显示行号
		{
			text: '名称',
			//width: 230,
			flex:1,
			align: 'center',
			dataIndex: 'name',
			hideable: false,
		}, {
			header: '所属小组',
			align: 'center',
			width: 180,
			dataIndex: 'groupName'
		}, {
			header: '创建日期',
			align: 'center',
			width: 180,
			sortable: true,
			dataIndex: 'createDate',
			renderer:function(value){
				if(value==null)
					return '无';
				else
					return value.replace('T', '  ');
			}
		}, {
			text: '操作',
			align: 'center',
			sortable: false,
			xtype: 'actioncolumn',
			width: 140,
			items: [{
				icon: 'static/images/icons/fam/look.ico',
				tooltip: '查看详情',
				handler: function(grid, rowIndex, colIndex, actionItem, event, record, row) {
					testProjectSeeDetailClick(record,true);
				}
			},'-',{
				icon: 'static/images/icons/fam/plan.ico',
				tooltip: '设计流程',
				handler: function(grid, rowIndex, colIndex, actionItem, event, record, row) {
					testProjectDesignProcessClick(record,true);
				}
			},'-',{
				icon: 'static/images/icons/fam/grade.ico',
				tooltip: '设计评分标准',
				handler: function(grid, rowIndex, colIndex, actionItem, event, record, row) {
					testGradeRuleDesignClick(record,true);
				}
			}]
		}]
});

//用于显示测试项目关联小组的选择Grid
var testProjectChooseGroupGrid=Ext.create('Ext.grid.Panel', {
	header:false,
	store: testProjectChooseGroupStore,
	columns: [new Ext.grid.RowNumberer(), //显示行号
	  		{
	  			text: '名称',
	  			flex:1,
	  			align: 'center',
	  			dataIndex: 'name',
	  			hideable: false,
	  		},{
	  			text: '组长',
	  			flex:1,
	  			align: 'center',
	  			dataIndex: 'leaderName',
	  			hideable: false,
	  		}
	],
	listeners:[{
		itemdblclick:function(view, record, item, index, e, eOpts ){
			testProjectDetailEditorForm.down('#group').setValue(record.data.name);
			testProjectDetailEditorForm.down('#group').groupId=record.data.id;
			testProjectChooseGroupWin.close();
		}
	}]
});

//用于显示测试项目关联测试系统的选择Grid
var testProjectChooseSystemGrid=Ext.create('Ext.grid.Panel', {
	header:false,
	store: testSystemGridStore,
	columns: [new Ext.grid.RowNumberer(),{
		text: '系统名称',
		dataIndex: 'name',
		sortable:false,
		flex: 1,
		filter: { //用于形成搜索框
			type: 'string',
			emptyText: '输入要搜索的系统名称',
			serializer: function(filter) {
				return filter.value;
			}
		}
	}, {
		text: '类型',
		dataIndex: 'type',
		sortable:false,
		flex: 1,
		renderer:function(value){
			return value==0?'实训项目':'真实项目';
		},
		filter: { //用于形成搜索框
			type: 'string',
			emptyText: '输入要搜索的类型',
			serializer: function(filter) {
				return filter.value;
			}
		}
	},{
		text : "创建时间",
		dataIndex : 'createDate',
		flex:1,
		renderer:function(value){
			if(value==null)
				return '无';
			else
				return value.replace('T', '  ');
		}
	}],
	plugins: {
		gridfilters: true //启用filters
	},
	listeners:[{
		itemdblclick:function(view, record, item, index, e, eOpts ){
			testProjectDetailEditorForm.down('#system').setValue(record.data.name);
			testProjectDetailEditorForm.down('#system').systemId=record.data.id;
			testProjectChooseSystemWin.close();
		}
	}]
});

